<template>
    <div class="schoolwork_list">
        <student-menu/>
        
        <div class="content mt-1">
            <Table :columns="columns" class="diy_table" :data="list"></Table>
            <div class="clearfix mt-2">
                <Page :current.sync="filters.page" :page-size="filters.list_rows" :total="total_page" show-sizer class="float-right" show-total @on-change="getList_page"/>
            </div>
        </div>
    </div>
</template>

<script>
import studentMenu from "@/components/studentMenu"
import pageMixin from "@/common/pageMixin"
import {transcripts_list} from "@/common/sapi"
export default {
    mixins:[pageMixin],
    data(){
        return {
            columns:[
                {
                    title:'课堂编号',
                    key:'lid',
                    width:100
                },
                {
                    title: '主题',
                    key: 'title',
                    render:(h,params)=>h('p',params.row.lessons.title)
                },
                {
                    title: '题目总数',
                    key: 'lesson_question_num',
                    width:100
                },
                {
                    title: '得分率',
                    key: 'accuracy',
                    width:180,
                    render:(h,params)=>{
                        return h('i-progress',{
                            props:{
                                percent:params.row.accuracy,
                            }
                        })
                    }
                },
                {
                    title: '交卷时间',
                    key: 'create_time',
                },
                {
                    title: '出卷老师',
                    render:(h,params)=>h('p',params.row.teacher.name)
                },
                {
                    title: '操作',
                    width:240,
                    align: 'center',
                    render:(h,params)=>{
                        return h('div',[
                            h('i-button',{
                                props:{
                                    type:'primary'
                                },
                                on:{
                                    click:()=>{
                                        this.$router.push({name:'join_lesson',query:{lid:params.row.lid}})
                                        // this.$router.push({name:'schoolwork_show',query:{lid:params.row.lid}})
                                    }
                                }
                            },'再来一次'),
                            h('i-button',{
                                class:'ml-1',
                                on:{
                                    click:()=>{
                                        this.$router.push({name:'schoolwork_show',query:{id:params.row.id}})
                                        // this.$router.push({name:'schoolwork_show',query:{lid:params.row.lid}})
                                    }
                                }
                            },'查看详情')
                        ])
                    }
                }
            ],
            list:[ ],
        }
    },
    methods:{
        getList(){
            transcripts_list(this.filters)
            .then(res=>{
                if(res){
                    this.list=res.data.list
                    this.total_page=res.data.pageinfo.total
                }
            })
        },
       
    },
    components:{
        studentMenu
    },
    created(){
        this.getList_page()
    }
}
</script>
